import React from 'react'
import '../views/ShopDetail/ShopDetail.less'
export default class Evaluation extends React.Component {
    constructor(props) {
        super(props)
    }
    render() {
        return (
            <div className='ShopD ShopD-pag'>
                {this.props.Eva.atavar === '' ? <div></div> : <div>
                    <div className='xin-center shopD-d2'>
                        <img className='shopD-d2-i1' src={this.props.Eva.atavar} alt="" />
                        <div className='shopD-d2-d1'>
                            <div className='shopD-d2-d2'>
                                <p>{this.props.Eva.nickName}</p>
                                <Xing star={this.props.Eva.star}></Xing>
                            </div>
                            <p className='shopD-d2-p1'>{this.props.Eva.createTime}</p>
                        </div>
                    </div>
                    <p className='xin-center ShopD-p5'>
                        {this.props.Eva.content}
                    </p>
                </div>
                }
            </div>
        )
    }
}
class Xing extends React.Component {
    constructor(props) {
        super(props)
    }
    shouldComponentUpdate(nextState) {
        if (nextState.star == this.props.star) {
            return false
        }
    }
    render() {
        var stars = new Array
        for (let i = 0; i < this.props.star; i++) {
            stars.push('')
        }
        console.log(stars)
        return stars.map((val, index) => (
            <img key={index} src={require('../static/img/xing.png')} alt="" />
        ))
    }
}